package com.bianmaba.spring.data.jpa.domain.entity;


import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * 基本实体类，此类包含ID,创建人，创建时间等字段，一个子类一个表，父类不会生成表。
 *
 * @author cWX183898
 */
@MappedSuperclass
@Inheritance(
        strategy = InheritanceType.TABLE_PER_CLASS
)
public abstract class BaseEntity extends UuidIdentityEntity {
    private static final long serialVersionUID = -5841448194726953221L;
    //创建人（此数据在创建完成后不允许更新）
    @Column(length = 64, nullable = false, updatable = false)
    protected String creator;

    //数据创建时间（1970到当前时间的毫秒数）
    @Column(nullable = false, updatable = false)
    protected Long cdt = new Date().getTime();


    public Long getCdt() {
        return cdt;
    }

    public void setCdt(Long cdt) {
        this.cdt = cdt;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

}
